package ch06.d1;

import org.junit.Test;

import java.util.Arrays;

public class StringBuilderTest {
    @Test
    public void testString(){
        String s="a";//byte[1]
        s+="b";//byte[2]
        s+="c";//byte[3]
        s+="d";//   byte[4]

        System.out.println(s);
    }

    @Test
    public void testNew(){
        StringBuilder b=new StringBuilder("hello");//byte[16]
//        b.append("hello");//16
//        b.append("world");//16
//        b.append("hello");//16
//        //搬家 原长度*2+2
//        b.append("world");//34

        System.out.println("长度："+b.length());
        System.out.println("容量："+b.capacity());
        System.out.println(b);

        Arrays.toString(new int[]{1,2,3});

    }

    @Test
    public void testArray(){
        int[][] a=new int[3][4];
        a[0]=new int[2];
        a[1]=new int[3];
        a[2]=new int[4];
        String s=new String();

    }
}
